# Tem Chanops Module.
# MODULE VERSION: 0.1 (BETA)
# Provides basic channel mode operations.
# (Should soon add optional support for +q and +a) :)



class Chanops_Module
	def initialize(command_handler, trigger, subject, parameters, authed)
		@subject = subject
		@command_handler = command_handler
		@trigger = trigger
		@parameters = parameters
		@parameters.scan(/\w+/) do |mode_nick|
			if @trigger == "op" and mode_nick.length > 1
				@command_handler.do_chanmode(@subject, "+o", mode_nick)
			elsif @trigger == "deop" and mode_nick.length > 1
				@command_handler.do_chanmode(@subject, "-o", mode_nick)
			elsif @trigger == "hop" and mode_nick.length > 1
				@command_handler.do_chanmode(@subject, "+h", mode_nick)	
			elsif @trigger == "dehop" and mode_nick.length > 1
				@command_handler.do_chanmode(@subject, "-h", mode_nick)	
			elsif @trigger == "voice" and mode_nick.length > 1
				@command_handler.do_chanmode(@subject, "+v", mode_nick)
			elsif @trigger == "devoice" and mode_nick.length > 1
				@command_handler.do_chanmode(@subject, "-v", mode_nick)	
			elsif @trigger == "admin" and mode_nick.length > 1
				@command_handler.do_chanmode(@subject, "+a", mode_nick)
			elsif @trigger == "deadmin" and mode_nick.length > 1
				@command_handler.do_chanmode(@subject, "-a", mode_nick)
			elsif @trigger == "founder" and mode_nick.length > 1
				@command_handler.do_chanmode(@subject, "+q", mode_nick)
			elsif @trigger == "defounder" and mode_nick.length > 1
				@command_handler.do_chanmode(@subject, "-q", mode_nick)				
			end
		end
	end
end

$Loaded_Modules["op"] = "Chanops_Module"
$Loaded_Modules["deop"] = "Chanops_Module"
$Loaded_Modules["hop"] = "Chanops_Module"
$Loaded_Modules["dehop"] = "Chanops_Module"
$Loaded_Modules["voice"] = "Chanops_Module"
$Loaded_Modules["devoice"] = "Chanops_Module"
$Loaded_Modules["admin"] = "Chanops_Module"
$Loaded_Modules["deadmin"] = "Chanops_Module"
$Loaded_Modules["founder"] = "Chanops_Module"
$Loaded_Modules["defounder"] = "Chanops_Module"
